<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos -->
			<title>Docs For Class Csv_Writer</title>
			<link rel="stylesheet" href="../../media/stylesheet.css" />
			<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
		</head>
		<body>
			<div class="page-body">			
<h2 class="class-name">Class Csv_Writer</h2>

<a name="sec-description"></a>
<div class="info-box">
	<div class="info-box-title">Description</div>
	<div class="nav-bar">
					<span class="disabled">Description</span> |
													<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
						|											<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
						
					</div>
	<div class="info-box-body">
        		<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Provides an easy-to-use interface for writing csv-formatted text files. It</p>
<p class="description"><p>does not make use of the PHP5 function fputcsv. It provides quite a bit of  flexibility. You can specify just about everything about how it writes csv</p></p>
		<p class="notes">
			Located in <a class="field" href="_Csv---Writer.php.html">/Csv/Writer.php</a> (line <span class="field">22</span>)
		</p>
		
				
		<pre></pre>
	
			</div>
</div>



	<a name="sec-var-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Variable Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
						<span class="disabled">Vars</span> (<a href="#sec-vars">details</a>)
							| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
								</div>
		<div class="info-box-body">
			<div class="var-summary">
																																																<div class="var-title">
					<span class="var-type">array</span>
					<a href="#$data" title="details" class="var-name">$data</a>
				</div>
																<div class="var-title">
					<span class="var-type"><a href="../../Csv/Csv_Dialect.html">Csv_Dialect</a></span>
					<a href="#$dialect" title="details" class="var-name">$dialect</a>
				</div>
																<div class="var-title">
					<span class="var-type">string</span>
					<a href="#$filename" title="details" class="var-name">$filename</a>
				</div>
																<div class="var-title">
					<span class="var-type">resource</span>
					<a href="#$handle" title="details" class="var-name">$handle</a>
				</div>
											</div>
		</div>
	</div>

	<a name="sec-method-summary"></a>
	<div class="info-box">
		<div class="info-box-title">Method Summary</span></div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
																		<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
				 
				|
						<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
		</div>
		<div class="info-box-body">			
			<div class="method-summary">
																																																																																																												
												<div class="method-definition">
											<span class="method-result">Csv_Writer</span>
										<a href="#__construct" title="details" class="method-name">__construct</a>
											(<span class="var-type">resource|string</span>&nbsp;<span class="var-name">$file</span>, [<span class="var-type"><a href="../../Csv/Csv_Dialect.html">Csv_Dialect</a></span>&nbsp;<span class="var-name">$dialect</span> = <span class="var-default">null</span>])
									</div>
																<div class="method-definition">
											<span class="method-result">void</span>
										<a href="#__destruct" title="details" class="method-name">__destruct</a>
										()
									</div>
																<div class="method-definition">
											<span class="method-result">null</span>
										<a href="#close" title="details" class="method-name">close</a>
										()
									</div>
																<div class="method-definition">
											<span class="method-result">boolean</span>
										<a href="#containsSpecialChars" title="details" class="method-name">containsSpecialChars</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>)
									</div>
																<div class="method-definition">
											<span class="method-result">string</span>
										<a href="#escape" title="details" class="method-name">escape</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>)
									</div>
																<div class="method-definition">
											<span class="method-result">array</span>
										<a href="#formatRow" title="details" class="method-name">formatRow</a>
											(<span class="var-type"></span>&nbsp;<span class="var-name">$row</span>)
									</div>
																<div class="method-definition">
											<span class="method-result"><a href="../../Csv/Csv_Dialect.html">Csv_Dialect</a></span>
										<a href="#getDialect" title="details" class="method-name">getDialect</a>
										()
									</div>
																<div class="method-definition">
											<span class="method-result">string|null</span>
										<a href="#getFileName" title="details" class="method-name">getFileName</a>
										()
									</div>
																<div class="method-definition">
											<span class="method-result">string</span>
										<a href="#quote" title="details" class="method-name">quote</a>
											(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>)
									</div>
																<div class="method-definition">
											<span class="method-result">void</span>
										<a href="#setDialect" title="details" class="method-name">setDialect</a>
											(<span class="var-type"><a href="../../Csv/Csv_Dialect.html">Csv_Dialect</a></span>&nbsp;<span class="var-name">$dialect</span>)
									</div>
																<div class="method-definition">
											<span class="method-result">void</span>
										<a href="#writeData" title="details" class="method-name">writeData</a>
										()
									</div>
																<div class="method-definition">
											<span class="method-result">void</span>
										<a href="#writeRow" title="details" class="method-name">writeRow</a>
											(<span class="var-type"></span>&nbsp;<span class="var-name">$row</span>)
									</div>
																<div class="method-definition">
											<span class="method-result">void</span>
										<a href="#writeRows" title="details" class="method-name">writeRows</a>
											(<span class="var-type">array</span>&nbsp;<span class="var-name">$rows</span>)
									</div>
								</div>
		</div>
	</div>		

	<a name="sec-vars"></a>
	<div class="info-box">
		<div class="info-box-title">Variables</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
										<a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
						
			
										| 
									<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
							
					</div>
		<div class="info-box-body">
			<a name="var$data" id="$data"><!-- --></A>
<div class="oddrow">

	<div class="var-header">
		<span class="var-title">
			<span class="var-type">array</span>
			<span class="var-name">$data</span>
			 = <span class="var-default">array()</span>			(line <span class="line-number">47</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Contains the in-menory data waiting to be written to disk</p>
	<ul class="tags">
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	
		
		

</div>
<a name="var$dialect" id="$dialect"><!-- --></A>
<div class="evenrow">

	<div class="var-header">
		<span class="var-title">
			<span class="var-type"><a href="../../Csv/Csv_Dialect.html">Csv_Dialect</a></span>
			<span class="var-name">$dialect</span>
						(line <span class="line-number">35</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Holds an instance of Csv_Dialect - tells writer how to write</p>
	<ul class="tags">
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	
		
		

</div>
<a name="var$filename" id="$filename"><!-- --></A>
<div class="oddrow">

	<div class="var-header">
		<span class="var-title">
			<span class="var-type">string</span>
			<span class="var-name">$filename</span>
						(line <span class="line-number">29</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">The filename of the file we're working on</p>
	<ul class="tags">
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	
		
		

</div>
<a name="var$handle" id="$handle"><!-- --></A>
<div class="evenrow">

	<div class="var-header">
		<span class="var-title">
			<span class="var-type">resource</span>
			<span class="var-name">$handle</span>
						(line <span class="line-number">41</span>)
		</span>
	</div>

	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Holds the file resource</p>
	<ul class="tags">
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	
		
		

</div>
						
		</div>
	</div>
	
	<a name="sec-methods"></a>
	<div class="info-box">
		<div class="info-box-title">Methods</div>
		<div class="nav-bar">
			<a href="#sec-description">Description</a> |
															<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
																	<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
						
		</div>
		<div class="info-box-body">
			<A NAME='method_detail'></A>

<a name="method__construct" id="__construct"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">Constructor __construct</span> (line <span class="line-number">56</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Class constructor</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">Csv_Writer</span>
		<span class="method-name">
			__construct
		</span>
					(<span class="var-type">resource|string</span>&nbsp;<span class="var-name">$file</span>, [<span class="var-type"><a href="../../Csv/Csv_Dialect.html">Csv_Dialect</a></span>&nbsp;<span class="var-name">$dialect</span> = <span class="var-default">null</span>])
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">resource|string</span>
				<span class="var-name">$file</span><span class="var-description">: Either a valid filename or a valid file resource</span>			</li>
					<li>
				<span class="var-type"><a href="../../Csv/Csv_Dialect.html">Csv_Dialect</a></span>
				<span class="var-name">$dialect</span><span class="var-description">: A Csv_Dialect object</span>			</li>
				</ul>
		
			
	</div>
<a name="method__destruct" id="__destruct"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">Destructor __destruct</span> (line <span class="line-number">249</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">When the object is destroyed, if there is still data waiting to be written to disk, write it</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			__destruct
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodclose" id="close"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">close</span> (line <span class="line-number">228</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Closes out this file (can be called explicitly, but is called automatically by __destruct())</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">null</span>
		<span class="method-name">
			close
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodcontainsSpecialChars" id="containsSpecialChars"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">containsSpecialChars</span> (line <span class="line-number">210</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Returns true if input contains quotechar, delimiter or any of the characters in lineterminator</p>
	<ul class="tags">
				<li><span class="field">return:</span> True if contains any special characters</li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">boolean</span>
		<span class="method-name">
			containsSpecialChars
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$input</span><span class="var-description">: A single value to be checked for special characters</span>			</li>
				</ul>
		
			
	</div>
<a name="methodescape" id="escape"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">escape</span> (line <span class="line-number">182</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Escapes a column (escapes quotechar with escapechar)</p>
	<ul class="tags">
				<li><span class="field">return:</span> Escaped input value</li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			escape
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$input</span><span class="var-description">: A single value to be escaped for output</span>			</li>
				</ul>
		
			
	</div>
<a name="methodformatRow" id="formatRow"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">formatRow</span> (line <span class="line-number">151</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Accepts a row of data and returns it formatted according to $this-&gt;dialect  This method is called by writeData()</p>
	<ul class="tags">
				<li><span class="field">return:</span> The formatted array (formatting determined by dialect)</li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">array</span>
		<span class="method-name">
			formatRow
		</span>
					(<span class="var-type"></span>&nbsp;<span class="var-name">$row</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$row</span><span class="var-description">: An array of data to be formatted for output to the file</span>			</li>
				</ul>
		
			
	</div>
<a name="methodgetDialect" id="getDialect"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">getDialect</span> (line <span class="line-number">73</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get the current Csv_Dialect object</p>
	<ul class="tags">
				<li><span class="field">return:</span> object</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result"><a href="../../Csv/Csv_Dialect.html">Csv_Dialect</a></span>
		<span class="method-name">
			getDialect
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodgetFileName" id="getFileName"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">getFileName</span> (line <span class="line-number">97</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Get the filename attached to this writer (unless none was specified)</p>
	<ul class="tags">
				<li><span class="field">return:</span> The filename this writer is attached to or null if it          was passed a resource and no filename</li>
				<li><span class="field">todo:</span> Add a functions file so that you can use convenience functions like        get('variable', 'default')</li>
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string|null</span>
		<span class="method-name">
			getFileName
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodquote" id="quote"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">quote</span> (line <span class="line-number">198</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Quotes a column with quotechar</p>
	<ul class="tags">
				<li><span class="field">return:</span> Quoted input value</li>
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">string</span>
		<span class="method-name">
			quote
		</span>
					(<span class="var-type">string</span>&nbsp;<span class="var-name">$input</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">string</span>
				<span class="var-name">$input</span><span class="var-description">: A single value to be quoted for output</span>			</li>
				</ul>
		
			
	</div>
<a name="methodsetDialect" id="setDialect"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">setDialect</span> (line <span class="line-number">84</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Change the dialect this csv reader is using</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			setDialect
		</span>
					(<span class="var-type"><a href="../../Csv/Csv_Dialect.html">Csv_Dialect</a></span>&nbsp;<span class="var-name">$dialect</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type"><a href="../../Csv/Csv_Dialect.html">Csv_Dialect</a></span>
				<span class="var-name">$dialect</span><span class="var-description">: the current Csv_Dialect object</span>			</li>
				</ul>
		
			
	</div>
<a name="methodwriteData" id="writeData"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">writeData</span> (line <span class="line-number">133</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Writes the data to the csv file according to the dialect specified  This method is called by close()</p>
	<ul class="tags">
				<li><span class="field">access:</span> protected</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			writeData
		</span>
				()
			</div>
	
		
			
	</div>
<a name="methodwriteRow" id="writeRow"><!-- --></a>
<div class="evenrow">
	
	<div class="method-header">
		<span class="method-title">writeRow</span> (line <span class="line-number">108</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Write a single row to the file</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			writeRow
		</span>
					(<span class="var-type"></span>&nbsp;<span class="var-name">$row</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$row</span><span class="var-description">: An array representing a row of data to be written</span>			</li>
				</ul>
		
			
	</div>
<a name="methodwriteRows" id="writeRows"><!-- --></a>
<div class="oddrow">
	
	<div class="method-header">
		<span class="method-title">writeRows</span> (line <span class="line-number">119</span>)
	</div> 
	
	<!-- ========== Info from phpDoc block ========= -->
<p class="short-description">Write multiple rows to file</p>
	<ul class="tags">
				<li><span class="field">access:</span> public</li>
			</ul>
	
	<div class="method-signature">
		<span class="method-result">void</span>
		<span class="method-name">
			writeRows
		</span>
					(<span class="var-type">array</span>&nbsp;<span class="var-name">$rows</span>)
			</div>
	
			<ul class="parameters">
					<li>
				<span class="var-type">array</span>
				<span class="var-name">$rows</span><span class="var-description">: An two-dimensional array representing rows of data to be written</span>			</li>
				</ul>
		
			
	</div>
						
		</div>
	</div>


	<p class="notes" id="credit">
		Documentation generated on Tue, 19 Feb 2008 21:05:34 -0800 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.1</a>
	</p>
	</div></body>
</html>